<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class M_kelas extends CI_Controller {

	function __construct() {
        parent::__construct();				
		$this->load->model("master/master_j_pendidikan"); 
		$this->load->model("master/master_kelas"); 			
	}
	
	function index()
	{
		$data['judul'] = "Master Kelas";
		$data['list'] = $this->master_j_pendidikan->read();
		$data['main_view']='master/kelas/j_pendidikan';
		$this->load->view('index',$data);
		
	}

	function kelas($id_m_j_pendidikan)
	{
		$data['judul'] = "Master Kelas";
		$data['list']=$this->master_kelas->kelas($id_m_j_pendidikan);	
		$data['list_jp']=$this->master_j_pendidikan->detail($id_m_j_pendidikan);	

		$data['main_view']='master/kelas/kelas';
		$this->load->view('index',$data);
	}

	function save()
	{
		$dataInsert = array(
			'id_m_j_pendidikan' => $this->input->post('id_m_j_pendidikan'),
			'kelas' => $this->input->post('kelas')
		);
		$this->master_kelas->save($dataInsert);
	}

	function edit()
	{
		$id_m_kelas = $this->input->post('id_m_kelas');
		$data['list']=$this->master_kelas->edit($id_m_kelas);	
		$this->load->view('master/kelas/edit',$data);
	}

	function update()
	{	
		$id_m_kelas=$this->input->post('id_m_kelas');
		$dataUpdate=array(
			'kelas'=>$this->input->post('kelas')
		);		
		$this->master_kelas->update($id_m_kelas,$dataUpdate);
	}

	function delete()
	{
		$id_m_kelas = $this->input->post('id_m_kelas');
		$this->master_kelas->delete($id_m_kelas);
	}
	
	function refresh($id_m_j_pendidikan)
	{
		$data['list']=$this->master_kelas->kelas($id_m_j_pendidikan);	
		$data['list_jp']=$this->master_j_pendidikan->detail($id_m_j_pendidikan);
		$this->load->view('master/kelas/refresh', $data);
		
	}
	
}